﻿<Window x:Class="RW.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:WPFExtensions.Controls;assembly=WPFExtensions" xmlns:UI="clr-namespace:RW"
        xmlns:graphsharp="clr-namespace:GraphSharp.Controls;assembly=GraphSharp.Controls"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <DataTemplate x:Key="demoTemplate">
            <StackPanel Orientation="Vertical" Margin="5">
                <TextBlock x:Name="tb" Text="{Binding Path=Text, Mode=OneWay}" Foreground="White" />
                <TextBlock x:Name="tb2" Text="{Binding Path=LoopText, Mode=OneWay}" FontSize="8" Foreground="White" />
            </StackPanel>
        </DataTemplate>
        <Style TargetType="{x:Type graphsharp:VertexControl}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type graphsharp:VertexControl}" >
                        <Border x:Name="border" BorderBrush="White" 
                            Background="Black"
                            BorderThickness="2"
                            CornerRadius="10,10,10,10"
                            Padding="{TemplateBinding Padding}">
                            <ContentPresenter Content="{TemplateBinding Vertex}" ContentTemplate="{StaticResource demoTemplate}"/>
                            <Border.Effect>
                                <DropShadowEffect BlurRadius="2" Color="LightGray" 
                            Opacity="0.3" Direction="315"/>
                            </Border.Effect>
                        </Border>
                        <ControlTemplate.Triggers>
                            <DataTrigger Binding="{Binding IsValid}" Value="false">
                                <Setter TargetName="border" Property="Background"
                                    Value="Red" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding IsInitial}" Value="true">
                                <Setter TargetName="border" Property="Background"
                                    Value="Green" />
                            </DataTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style TargetType="{x:Type graphsharp:EdgeControl}">
            <Style.Resources>
                <ToolTip x:Key="ToolTipContent">
                    <StackPanel>
                        <TextBlock Text="{Binding Tag}"/>
                    </StackPanel>
                </ToolTip>
            </Style.Resources>
            <Setter Property="ToolTip" Value="{StaticResource ToolTipContent}"/>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>

        <Menu Grid.Row="0" HorizontalAlignment="Stretch">
            <MenuItem Header="QUERY 1" Name="query1" Click="query1_Click"/>
            <MenuItem Header="QUERY 2" Name="query2" Click="query2_Click"/>
            <MenuItem Header="QUERY 3" Name="query3" Click="query3_Click"/>
        </Menu>

        <Controls:ZoomControl Grid.Row="1">
            <!--LayoutAlgorithmType="ER"-->
            <UI:StateGraphLayout x:Name="gl"
                                 LayoutAlgorithmType="ISOM"
                                OverlapRemovalAlgorithmType="FSA"
                                HighlightAlgorithmType="Simple"
                                DestructionTransition="{x:Null}">
            </UI:StateGraphLayout>
        </Controls:ZoomControl>
    </Grid>
</Window>
